/* Author : Putri Andita R
 * 		    091511059
 * Proyek 4*/


package jtk.project4.fleet.field;


import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;


public class PartTableField extends GroupControl{
	
	private TableField<String>  partTable;
	
	public PartTableField(String bindID){
		
		setBindID(bindID);
		createFields();
		createLayout();
	}	
	
	private void createFields() {
		//setup table
		partTable = new TableField<String>("parts","part");
		partTable.setTitle("headerpartTable");
		partTable.setAutoResizeMode(AutoResizeMode.ALL_COLUMNS);
		partTable.getSelectionValues();
		
		//add columns
		partTable.addColumn("label.part #","part");
		partTable.addColumn("label.name","name");
		partTable.addColumn("label.description","description");
		partTable.addColumn("label.qty","qty");
		
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		addField(createFieldGroup(),CENTER);
	}
	
	
	private GroupControl createFieldGroup(){
		GroupControl fieldGroup=new GroupControl();
		fieldGroup.addField(partTable,CENTER);
		return fieldGroup;
	}	
}
